import { createApp } from 'vue'
import gykUI from '../index'
import "@/assets/styles/index.scss"
import App from './App.vue'
import router from '@/router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { directive, modal, tag } from '@gyk/gyk-plugins'

const app = createApp(App)

// 声明一下Mitt，就能有代码提示
declare module 'vue' {
  export interface ComponentCustomProperties {
    $modal: typeof modal,
    $tag: typeof tag,
  }
}

// 注册全局属性
// 添加modal和tag属性
app.config.globalProperties.$modal = modal
app.config.globalProperties.$tag = tag

// 注册自定义组件
app.use(gykUI)
app.use(router)
app.use(ElementPlus, {
  locale: zhCn,
})
// 字体图标引入（全局注册）
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 挂载在指定节点上
app.mount('#app')